<?php
	function add_planet() {
		extract($_POST);
		$query = mysql_query("INSERT INTO planets (name, size) VALUES ('{$name}', {$size})");
		echo "<h3><a href='planets.php'>Planet Created</a></h3>";
	}
	
	function edit_planet() {
		extract($_POST);
		$id = $_GET["id"];
		$query1 = mysql_query("UPDATE planets SET name = '{$name}' WHERE id = {$id}");
		$query2 = mysql_query("UPDATE planets SET size = {$size} WHERE id = {$id}");
		echo "<h3><a href='planets.php'>Planet Edited</a></h3>";
	}
	
	function add_deposit() {
		extract($_POST);
		$date = date("Y-m-d H:i:s");
		$query = mysql_query("INSERT INTO deposits (value, rmtype, planet, terrain, x, y) VALUES ({$value}, {$rmtype}, {$planet}, {$terrain}, {$x}, {$y})");
		echo "<h3><a href='deposits.php'>Deposit Added</a></h3>";
	}
	
	function edit_deposit() {
		extract($_POST);
		$id = $_GET["id"];
		$query1 = mysql_query("UPDATE deposits SET value = {$value} WHERE id = {$id}");
		$query2 = mysql_query("UPDATE deposits SET rmtype = {$rmtype} WHERE id = {$id}");
		$query3 = mysql_query("UPDATE deposits SET planet = {$planet} WHERE id = {$id}");
		$query4 = mysql_query("UPDATE deposits SET terrain = {$terrain} WHERE id = {$id}");
		$query5 = mysql_query("UPDATE deposits SET x = {$x} WHERE id = {$id}");
		$query6 = mysql_query("UPDATE deposits SET x = {$x} WHERE id = {$id}");
		$query7 = mysql_query("UPDATE deposits SET y = {$y} WHERE id = {$id}");
		echo "<h3><a href='deposits.php'>Deposit Edited</a></h3>";
	}
	
	function delete_deposit() {
		$id = $_GET["id"];
		$query = mysql_query("DELETE FROM deposits WHERE id = {$id}");
		echo "<h3><a href='deposits.php'>Deposit Deleted</a></h3>";
	}